﻿#region [===== Using =====]
using System;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Workflow;
#endregion

namespace TPG.SharePoint.Workflow
{
    /// <summary>
    /// Provides access to several key pieces of information about
    /// an ASP.NET page used to drive a SharePoint workflow.
    /// </summary>
    /// <remarks>
    /// This interface is necessary for accessing all workflow pages 
    /// using a single Type, since workflow pages derive from either 
    /// Page or LayoutsPageBase.
    /// </remarks>
    public interface IWorkflowPage
    {
        #region [===== Properties =====]
        /// <summary>
        /// Gets an object representing the metadata for the workflow form.
        /// </summary>
        /// <remarks>
        /// The metadata for a workflow form consists of properties such as 
        /// the target list, list item, site object or the page-type of the
        /// form.
        /// </remarks>
        /// <returns></returns>
        WorkflowMetaData WorkflowMetaData { get; }
        /// <summary>
        /// Gets the <see cref="SPWorkflowTemplate"/> which serves as the
        /// template for the workflow.
        /// </summary>
        SPWorkflowTemplate WorkflowTemplate { get; }
        /// <summary>
        /// Gets the <see cref="SPWorkflowAssociation"/> which defines the
        /// association between the workflow template and container to which 
        /// the workflow is applied.
        /// </summary>
        SPWorkflowAssociation WorkflowAssociation { get; }
        /// <summary>
        /// Gets a value indicating whether the form is being loaded and 
        /// accessed for the first time.
        /// </summary>
        /// <remarks>
        /// This value is similar to the 
        /// <see cref="System.Web.UI.Page.IsPostBack" /> property. However,
        /// some workflow forms are loaded as the result of a client postback 
        /// request. For these forms the IsPostBack property does not return 
        /// a value that can be used to initialize the form once, since it will
        /// always return true.
        /// </remarks>
        bool IsInitialLoad { get; }
        /// <summary>
        /// Gets a value indicating the type of MasterPage to load for the 
        /// workflow form.
        /// </summary>
        MasterPageMode MasterPageMode { get; set; }
        #endregion
    }
}
